import time
import binascii

from myUtils.portcommunication import PortCommunication
from myUtils.bc25 import BC25


if __name__ == '__main__':
    # 串口初始化
    port = PortCommunication('com3', 9600, 2)

    # port.send_data('AT+CIMI\r\n'.encode())
    # time.sleep(1)
    # print(port.read_data())
    # port.print_port_info()
    # port.close_port()

    # bc25初始化
    bc25_device = BC25(port)


    # MQTT初始化
    bc25_device.mqtt_init()
    bc25_device.aliyun_mqtt_pub_data(50)
    print("------------BC25 Init End------------")

    # 发送信息
    bc25_device.aliyun_mqtt_pub_data(50)
    bc25_device.aliyun_mqtt_pub_data(77)

    # 关闭连接
    bc25_device.colse_mqtt()
